php使用phpword生成word文档
// Define cell style arrays
$c = "前三日雨量报表";
// Add image elements
// Save File
$table->addCell(2300)->addText($arr["STCD"]);
$table->addRow();
}else if($arr["STTP"] == 'ZB'){
}
// Add table style
/**********文本格式的word text.php************/
}else{
}else if($arr["STTP"] == 'ZZ'){
// Define font style for first row
$section->addText($c, 'rStyle', 'pStyle'); if($arr["STTP"] == 'MM'){
$content="根据市气象局未来24小时降雨预报和市水利局实时降雨数据,市国土资源局进行了地质灾害预报,请有关部门关注
require_once '../libs/PHPWord/PHPWord.php';}else if($arr["STTP"] == 'ZG'){
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
}else{ mssql_select_db($config['mssql']['dbname'],$conn);
// Add row设置行高
$table->addCell(2300, $styleCell)->addText('站码', $fontStyle);
/******地质灾害*******/
}else if($arr["STTP"] == 'SS'){
$res=mssql_query($sql);
$section = $PHPWord->createSection();
$table->addCell(2300, $styleCell)->addText('水文站监测类型', $fontStyle); header("Content-type: application/vnd.ms-word");
$PHPWord->addFontStyle('rStyle', array('bold'=>false, 'italic'=>false, 'size'=>16));
require_once '../../config.php';
}else if($arr["STTP"] == 'BB'){
}else if($arr["STTP"] == 'DD'){
$table->addCell(2300)->addText('堰闸水文站');
$section->addTextBreak(2);
$styleTable = array('borderSize'=>6, 'borderColor'=>'006699', 'cellMargin'=>80);
}else if($arr["STTP"] == 'DP'){
$sql = "EXEC HNOW05_GETPPSPACE '','','".$stm."',1,1";
$table->addCell(2300, $styleCell)->addText('站名', $fontStyle);
$table->addCell(2300)->addText('蒸发站');
$table->addCell(2300)->addText('墒情站');
$tm=date('Y-m-d H:i:s');
$fontStyle = array('bold'=>true, 'align'=>'center');
}else if($arr["STTP"] == 'TT'){
}
// New portrait section
$table->addCell(2300)->addText('雨量站');
$objWriter->save('php://output');
$table->addCell(2300)->addText('泵站');
注意:要将PHPWord\PHPWord\Template.php中的setValue方法下的编码改成$replace = iconv('gbk', 'utf-8',$replace);其他的文件也要改成这种样式的。否则出现中文乱码。
实时预警信息,做好地质灾害防范工作";
//echo $arr["STCD"]."</br>";
$table->addCell(2300)->addText('河道水位水文站');
$table->addRow(500);
$section->addText($content);
header("Content-Disposition:attachment;filename=".$fileName.".docx");
// Add table
if(in_array('3', $a, TRUE)){
$a = explode(',',$arr);
$section->addText($c, 'rStyle', 'pStyle');
$arr = $_REQUEST['arr'];
$PHPWord->addFontStyle('rStyle', array('bold'=>true, 'italic'=>true, 'size'=>16));
$section = $PHPWord->createSection();
// require_once '../common/conn.php'; //设置标题
}else if($arr["STTP"] == 'RR'){
$table->addCell(2300)->addText($arr["P"]);
$styleFirstRow = array('borderBottomSize'=>18, 'borderBottomColor'=>'0000FF', 'bgColor'=>'66BBFF'); $table->addCell(2300)->addText('落潮位站');
$PHPWord->addParagraphStyle('pStyle', array('align'=>'center', 'spaceAfter'=>100)); $styleCell = array('valign'=>'center');
require_once '../libs/PHPWord/PHPWord/IOFactory.php';
}
while($arr = mssql_fetch_array($res)){
}else if($arr["STTP"] == 'PP'){
if(in_array('1', $a, TRUE)){
$table->addCell(2300)->addText('地下水站');
$table->addCell(2300, $styleCell)->addText('雨量', $fontStyle);
?>
//逗号 分割字符串
$conn = mssql_connect($config['mssql']['host'],$config['mssql']['user'],$config['mssql']['password']);
$PHPWord->addTableStyle('myOwnTableStyle', $styleTable, $styleFirstRow);
$stm = date('Y-m-d H:i:s',strtotime('-3 days'));
$table->addCell(2300)->addText('水库水文站');
/**********前多日雨量*********/
$c = "地质灾害";
$PHPWord->addParagraphStyle('pStyle', array('align'=>'center', 'spaceAfter'=>100));
$section->addImage("images/image001.jpg", array('width'=>600, 'height'=>480, 'align'=>'center'));
复制代码 代码如下:
//exit($tm);$table->addCell(2300)->addText('气象站');
$PHPWord = new PHPWord();
<?php
}
$table = $section->addTable('myOwnTableStyle');// New Word Document
//echo $arr;
相关热词: php
本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!
本文地址: https://v30.fanwenzhu.com/jq/jc/6253.shtml
相关文章
热门TAG
win10 ecshop 主机 阿里云 解决 配置 C# C++ 解析 SQL语句 命令 Go语言 方法 CSS3 HTML5 CSS win7 MSSQL 服务器配置 IIS7.5 IIS7 IIS6 IIS CentOS 7 Linux oracle数据库 oracle phpcms discuz discuz教程最新文章
-
PHP识别相片是否是颠倒的
时间:2020-12-28
-
python编程有哪些ide
时间:2020-12-28
-
python开发工程师是做什么
时间:2020-12-28
-
php构造函数的作用
时间:2020-12-28
-
php怎么跟数据库连接
时间:2020-12-28
-
php实现顺序线性表
时间:2020-12-28
-
Python多重继承中的菱形继
时间:2020-12-28
-
php中break的作用
时间:2020-12-28
热门文章
-
php中常用的正则表达式使用方法
时间:2020-12-25
-
asp与php区别是什么?
时间:2020-12-27
-
PHP识别相片是否是颠倒的,并且重新摆正
时间:2020-12-28
-
Yii授权之基于角色的存取控制 (RBAC)
时间:2020-12-23
-
php的一键安装包有哪些 php环境搭建
时间:2020-12-19
-
php实现对图片对称加解密(适用身份证加
时间:2020-12-25
-
php如何理解面向对象
时间:2020-12-28
-
超详细分析php docker的原理及作用
时间:2020-12-27
-
Python控制Excel实现自动化办公
时间:2020-12-23
-
session的作用是什么
时间:2020-12-25
